package com.atguigu.springcloud.alibaba;

import com.atguigu.springcloud.alibaba.entity.Apple;

import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.function.Function;
import java.util.function.Predicate;

/**
 * fanw
 */
public class LambdaExpression {

    public static void main(String[] args) {

        Comparator<Apple> byColor = new Comparator<Apple>() {
            @Override
            public int compare(Apple o1, Apple o2) {
                return o1.getColor().compareTo(o2.getColor());
            }
        };

        List<Apple> list = Collections.emptyList();

        list.sort(byColor);

        Comparator<Apple> byColor2 = (o1, o2) -> o1.getColor().compareTo(o2.getColor());
        String s1 = "23423423";
        Function<String, Integer> flambda = s2 -> s1.length();
        Predicate<Apple> p = (Apple a) -> a.getColor().equals("green");

        Runnable r = () -> {
        };


        Function<Apple, Boolean> f = (a3) -> a3.getColor().equals("green");

    }
}
